<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		原生js版本比较重点的操作dom
		<hr >
		<div class="wrap" id="d1">
			<div class="wrapitem">0</div>
			<div class="wrapitem">1</div>
			<div class="wrapitem" id="d1item2">2</div>
			<div class="wrapitem">3</div>
			<div class="wrapitem">4</div>
			<div class="wrapitem">5</div>
			<div class="wrapitem">6</div>
		</div>
		<script type="text/javascript">
			//后面追加元素append
			document.getElementById('d1').appendChild((function(){
				var dom = document.createElement('div')
				dom.className = 'wrapitem'
				dom.innerHTML = 'append追加的元素'
				return dom
			})())
			//最开始元素前追加insertBefore
			document.getElementById('d1').insertBefore((function(){
				var dom = document.createElement('div')
				dom.className = 'wrapitem'
				dom.innerHTML = 'insertBefore追加的元素'
				return dom
			})(),document.getElementById('d1').children[0])
			//查找元素相邻的前面元素previousElementSibling
			/* 为了方便，直接给了个d1item2这个id */
			document.getElementById('d1item2').previousElementSibling
			.innerHTML = '1__previousElementSibiling修改的值'
			//查找元素相邻的后面面元素nextElementSibling
			/* 为了方便，直接给了个d1item2这个id */
			document.getElementById('d1item2').nextElementSibling
			.innerHTML = '3__nextElementSibling修改的值'
			/*删除节点*/
			function removeElement(_element){
				/*传入节点*/
				var _parentElement = _element.parentNode;
				if(_parentElement){
					_parentElement.removeChild(_element);
				}
			}
			/* 复制元素 element.cloneNode(true) */
		</script>
	</body>
</html>
